package com.awise.app.more.activity;

import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;

import com.awise.R;
import com.awise.base.BaseActivity;


/**
 * Created by lgz on 2018/1/23.
 */

public class AboutUsActivity extends BaseActivity implements View.OnClickListener {
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.more_about_us_layout);
        initView();
    }

    private void initView() {
        TextView s_back = (TextView) this.findViewById(R.id.tv_back);
        s_back.setVisibility(View.VISIBLE);
        s_back.setOnClickListener(this);
        TextView textView_content = (TextView) this.findViewById(R.id.textView_content);
        textView_content.setText(R.string.about_us);
        TextView about_us_tv_version = (TextView) this.findViewById(R.id.about_us_tv_version);
        about_us_tv_version.setText(getVersion());

    }

    @Override
    public void onClick(View view) {
        switch (view.getId()){
            case R.id.tv_back:
                finish();
                break;
        }
    }

    /**
     * 获取版本号
     * @return 当前应用的版本号
     */
    public String getVersion() {
        try {
            PackageManager manager = this.getPackageManager();
            PackageInfo info = manager.getPackageInfo(this.getPackageName(), 0);
            String version = "  V"+info.versionName;
            return this.getString(R.string.app_name) + version;
        } catch (Exception e) {
            e.printStackTrace();
            return this.getString(R.string.app_name);
        }
    }
}
